import React, { Component } from 'react'
import {HashRouter as Router,Route,Switch,Redirect} from "react-router-dom"
import Index from "./component/index/Index"
import Category from "./component/category/Category"
import Cart from "./component/cart/Cart"
import My from "./component/my/My"
import Tabbar from "./component/tabbar/Tabbar"
import SearchCenter from "./component/searchCenter/searchCenter"
import GoodsDetail from "./component/goodsDetail/goodsDetail"
// 定义一个404页面
function PageNoFind(){
    return <h1>404页面！！</h1>
}
export default class RouterConfig extends Component {
    render() {
        return (
            <Router>
                <Switch>
                <Route path="/" exact render={()=><Tabbar><Index></Index></Tabbar>}></Route>
                <Route path="/category" exact render={()=><Tabbar><Category></Category></Tabbar>}></Route>
                <Route path="/cart" exact render={()=><Tabbar><Cart></Cart></Tabbar>}></Route>
                <Route path="/my" exact render={()=><Tabbar><My></My></Tabbar>}></Route>
                <Route path="/searchCenter" exact render={()=><SearchCenter></SearchCenter>}></Route>
                
               
                <Route path="/goodsDetail/:goods_id" exact render={(props)=><GoodsDetail {...props}></GoodsDetail>}></Route>
    

                <Route path="/404" component={PageNoFind}></Route>
                <Redirect to="/404"></Redirect>
                </Switch>
            </Router>
        )
    }
}
